<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      /* 设置行高高度与盒子高度相同 */
      .box {
        height: 100px;
        background-color: #f00;
        color: #fff;
        line-height: 100px;
      }
    </style>
  </head>
  <body>
    <div class="box">我是div元素</div>
  </body>
</html>
